package cn.flexui.flexuiserver.service.impl;

import cn.flexui.flexuiserver.domain.entity.ChatCodeRecord;
import cn.flexui.flexuiserver.mapper.ChatCodeRecordMapper;
import cn.flexui.flexuiserver.service.ChatCodeRecordService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 代码记录 服务实现类
 * </p>
 *
 * @author apeto
 * @since 2024-09-26 08:51:01
 */
@Service
public class ChatCodeRecordServiceImpl extends ServiceImpl<ChatCodeRecordMapper, ChatCodeRecord> implements ChatCodeRecordService {

    @Override
    public ChatCodeRecord getByRequestIdOne(String requestId) {
        LambdaQueryWrapper<ChatCodeRecord> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ChatCodeRecord::getRequestId,requestId);
        queryWrapper.orderByDesc(ChatCodeRecord::getId);
        queryWrapper.last("limit 1");
        return getOne(queryWrapper);
    }
}
